#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QSpinBox>
#include <QDialog>
#include <QTcpServer>
#include <QTextEdit>
#include <QTcpSocket>
#include <QPlainTextEdit>

#include"deck.h"
#include"player.h"
#include"hand.h"
#include"card.h"

class Deck;

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
     Widget(QWidget *parent = 0);
    ~Widget();
     void createShuffledarr(int arr[15]);
     void if_mechip();
     void if_end();
     void up_score(std::vector<int>& cardPool, Player * plyrs[6]);
     void if_me();

public:

     QLabel * l_player[6];
     QLabel * w_abandon;
     QLabel * w_public;

     QVBoxLayout * VLayou1;
     QVBoxLayout * VLayou2;
     QVBoxLayout * VLayou3;
     QVBoxLayout * VLayou4;
     QVBoxLayout * VLayou5;

     QVBoxLayout * VLayou01;

     QPushButton * pushbtn;
     QPushButton * pushbtn_chip;
     QPushButton * btn_show;
     QPushButton * btn_change;
     QPushButton * btn_check;
     QPushButton * btn_reject;
     QPushButton * btn_pub;
     QPushButton * btn_raise;
     QPushButton * btn_call;
     QPushButton * btn_fold;
     QPushButton * btn_all;

     QPushButton * btn_start;
     QPushButton * btn_tcps;

     QHBoxLayout * HLayou;
     QHBoxLayout * HLayou_01;
     QHBoxLayout * HLayou_02;
     QHBoxLayout * HLayou_03;
     QHBoxLayout * HLayou_04;

     QTextEdit * w_port;

     QPlainTextEdit * w_record;
     QPlainTextEdit * record;

     QSpinBox * spin_raise;

     QString txt[6];

signals:
    void cchange();
    void chips();

private:
    Ui::Widget *ui;

    int plyr_num;//已连接的玩家数

    int Shuffled[15];//洗牌数组

    Card * w_card[15];
    Hand * w_hand[6];
    Player * w_plyr[6];
    Deck * w_deck;

    QTcpServer * m_s;

    QList<QTcpSocket*> m_tcp;//可以允许多个客户端连接

    QWidget * newidget;

private slots:
    void game_start();
    void start_chip();
    void show_card();
    void if_change();
    void c_change();
    void r_change();
    void if_pub();
    void w_raise();
    void w_fold();
    void w_call();
    void w_all();
    void start_listen();
    void analyze();
    void start_game();
};


#endif // WIDGET_H
